﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using java.io;
using org.apache.commons.io;
using org.slf4j;

namespace Game.utils
{
    public class Files
{
	/**
	 * Field _log.
	 */
	private static Logger _log = LoggerFactory.getLogger(typeof(Files));
	
	/**
	 * Method writeFile.
	 * @param path String
	 * @param string String
	 */
	public static void writeFile(String path, String str)
	{
		try
		{
			FileUtils.writeStringToFile(new File(path), str, "UTF-8");
		}
		catch (IOException e)
		{
			_log.error("Error while saving file : " + path, e);
		}
	}
	
	/**
	 * Method copyFile.
	 * @param srcFile String
	 * @param destFile String
	 * @return boolean
	 */
	public static bool copyFile(String srcFile, String destFile)
	{
		try
		{
			FileUtils.copyFile(new File(srcFile), new File(destFile), false);
			return true;
		}
		catch (IOException e)
		{
			_log.error("Error while copying file : " + srcFile + " to " + destFile, e);
		}
		return false;
	}
}
}
